﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PuntoVenta.aspx.cs" Inherits="Venta_PuntoVenta" MasterPageFile="~/Master.master"  %>

<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContenidoPrincipal" Runat="Server">


    <asp:ScriptManager ID="ScriptManager1" runat="server" 
        onasyncpostbackerror="ScriptManager1_AsyncPostBackError" AsyncPostBackErrorMessage="" AsyncPostBackTimeout="500">
    </asp:ScriptManager>
    <table style="width: 439px" class="Tabla" id="TABLE1" align="center" >
        <tr>
            <td align="center" colspan="3" style="width: 400px; height: 15px" class="Titulo">
                PUNTO DE VENTA</td>
        </tr>
    
        <tr>
            <td style="width: 221px; height: 15px" valign="top">
                            <asp:Label ID="Label1" runat="server" Text="Opcion de Lectura"></asp:Label></td>
            <td style="width: 16px; height: 15px" valign="top">
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Seleccione la opcion de lectura" ControlToValidate="rblOpcion" Display="Dynamic" SetFocusOnError="True" ValidationGroup="Iniciar">*</asp:RequiredFieldValidator></td>
            <td style="color: #663300; height: 15px">
                <asp:RadioButtonList ID="rblOpcion" runat="server" RepeatDirection="Horizontal" Width="183px">
                    <asp:ListItem Value="1">Codigo de Barras</asp:ListItem>
                    <asp:ListItem Value="2">RFID</asp:ListItem>
                </asp:RadioButtonList></td>
        </tr>        

        <tr>
            <td style="width: 221px; height: 22px;">
            </td>
            <td style="width: 16px; height: 22px;">
            </td>
            <td align="right" style="height: 22px">
                &nbsp;<asp:Button ID="btnIniciar" runat="server" CssClass="Boton" OnClick="btnIniciar_Click"
                    Text="Iniciar" ValidationGroup="Iniciar" Width="68px" />
                <asp:Button ID="btnDetener" runat="server" CssClass="Boton" OnClick="btnDetener_Click"
                    Text="Detener" />&nbsp;
            </td>
        </tr>
        <tr>
            <td align="center" style="height: 10px" colspan="3">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <table style="width: 407px; height: 2px">
                            <tr>
                                <td style="width: 20px; height: 15px;">
                                    <asp:Label ID="Label3" runat="server" Width="44px">Inicio:</asp:Label></td>
                                <td style="width: 3px; height: 15px;" align="left">
                                    <asp:Label ID="lblInicio" runat="server" Width="143px"></asp:Label></td>
                                <td colspan="1" style="width: 43px; height: 15px;">
                                    <asp:Label ID="Label5" runat="server" Width="27px">Final:</asp:Label></td>
                                <td colspan="1" style="height: 15px" align="left">
                                    <asp:Label ID="lblTimer" runat="server" Width="157px"></asp:Label></td>
                            </tr>
                            <tr>
                                <td colspan="4">
                                    <asp:Label ID="lblUltima" runat="server" Width="135px">Venta No.:  </asp:Label>
                                    <asp:Label ID="lblRecepcion" runat="server" Width="168px"></asp:Label></td>
                            </tr>
                        </table>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="Timer" EventName="Tick" />
                    </Triggers>
                </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
            <td colspan="3">
<asp:ValidationSummary ID="ValidationSummary1" runat="server" CssClass="Label" ShowMessageBox="True"
        ShowSummary="False" ValidationGroup="Grabar" />            
            &nbsp<br /></td>
        </tr>

        </table>

    <asp:Timer ID="Timer" runat="server" OnTick="Timer_Tick" Interval="4000" Enabled="False">
    </asp:Timer>

    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
        <ContentTemplate>

        <table style="width: 600px" class="Tabla" id="TABLE2" align="center" >
        <tr>
            <td colspan="3" align="center">
                <table style="width:100%">
                    <tr>
                        <td class="Titulo" colspan="3">
                        INFORMACIÓN DEL CLIENTE
                        </td>
                    </tr>
                    <tr align="left">
                        <td>Nombre:</td>
                        <td>
                        <asp:HiddenField ID="hdnIdCliente" runat="server" Value="0" />
                        <asp:Label ID="lblNombreCliente" runat="server" Text=""></asp:Label>
                        </td>
                        <td rowspan="2">
                            <asp:Image ID="imgFotoCliente" runat="server" />                                                    
                        </td>
                    </tr>
                    <tr align="left">
                        <td>Puntos:</td>
                        <td>
                        <asp:Label ID="lblPuntosCliente" runat="server" Text=""></asp:Label>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        
    </table>
    
    &nbsp;
    <table class="Tabla" align="center">
        <tr>
            <td align="center" style="height: 15px" class="Titulo" colspan="2">
                PRODUCTOS LEÍDOS&nbsp;
            </td>
        </tr>
        <tr>            
            <td>
                <asp:Label ID="lblSerial" runat="server" Text="Serial #" Width="111px" Visible="false"></asp:Label>
                <asp:TextBox ID="txtSerial" runat="server" Width="259px" CssClass="TextBox" 
                    Height="16px" Visible="false" AutoPostBack="True" 
                    ontextchanged="txtSerial_TextChanged"></asp:TextBox>                
                </td>
            <td style="width: 158px">
                &nbsp;
            </td>           
        </tr>
        <tr>
            <td style="height: 15px">

                <asp:GridView ID="grdRecepcion" runat="server" AllowSorting="True"
                    BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px"
                    CellPadding="4" ForeColor="Black" GridLines="Vertical" 
                    Width="508px">
                    <FooterStyle BackColor="#CCCC99" />
                    <RowStyle BackColor="#F7F7DE" Font-Bold="False" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                    <HeaderStyle Font-Bold="True" ForeColor="White" HorizontalAlign="Center" CssClass="HeaderStyle" />
                    <AlternatingRowStyle BackColor="White" />
                        </asp:GridView>

            </td>
            <td>
                <table>
                    <tr>
                        <td><asp:Label ID="lblTotal1" runat="server" Width="111px" Font-Bold="True" 
                                Font-Size="Medium" Visible="false" Text="TOTAL: $"></asp:Label></td>
                        <td><asp:Label ID="lblPrecioTotal" runat="server" Width="111px" Font-Bold="True" 
                                Font-Size="Medium" Visible="false"></asp:Label></td>
                    </tr>
                    <tr>
                        <td><asp:Label ID="lblTotal2" runat="server" Width="111px" Font-Bold="True" 
                                Font-Size="Medium" Visible="false" Text="PUNTOS: "></asp:Label></td>
                        <td><asp:Label ID="lblPuntosCompra" runat="server" Width="111px" Font-Bold="True" 
                                Font-Size="Medium" Visible="false"></asp:Label></td>
                    </tr>
                </table>
            </td>
        </tr>

    </table>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Timer" EventName="Tick" />
    </Triggers>
</asp:UpdatePanel>

    <br />
    <table id="tblFormaPago" runat="server" visible="false" align="center" style="width: 400px">
        <tr>
            <td class="Titulo" colspan="2">FORMA DE PAGO</td>
        </tr>
        <tr>            
            <td align="left">                    
                <asp:RadioButton ID="rbtnCredito30" runat="server" Text="Crédito 30 días" 
                    Checked="True" GroupName="FormaPago" /><br />                    
                <asp:RadioButton ID="rbtnCredito60" runat="server" Text="Crédito 60 días" 
                    GroupName="FormaPago" /><br />                    
                <asp:RadioButton ID="rbtnContraEntrega" runat="server" Text="Contra entrega" 
                    GroupName="FormaPago" />  <br />                                     
                <asp:RadioButton ID="rbtnEfectivo" runat="server" Text="Efectivo" 
                    GroupName="FormaPago" Checked="true" />                                    
                        
            </td>
            <td align="center" valign="middle">
            <asp:Button ID="btnPagar" runat="server" CssClass="Boton" Height="80" Width="80"
                Text="PAGAR" onclick="btnPagar_Click" />               
            </td>
        </tr>        
    </table>

</asp:Content>

